<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'basic';
$return=array();
/*******basic*******/
if($_RQ['op']=='basic'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		if($postdata['goodstype'] && !$postdata['goodsid']){
			exi('请选择商品！','error');
		}
		if($postdata['goodstype']==1){
			$postdata['goodstitle']=pdo_getcolumn('jy_goodsfw_goods',array('id'=>$postdata['goodsid'],'merchid'=>$_SESSION['onemerchid']),'title');
		}elseif($postdata['goodstype']==2){
			$postdata['goodstitle']=pdo_getcolumn('jy_weishop_goods',array('id'=>$postdata['goodsid'],'merchid'=>$_SESSION['onemerchid']),'title');
		}
		$this->model('model')->uplog($postdata,0,true);
		exi('提交上报成功！');
	}
	$return['item']=array('goodstype'=>0);
	$htmls=array(
		'type'=>'edit',
		'desc'=>'商品上报',
		'edit'=>array(
			array('name'=>'goodstype','title'=>'商品来源','type'=>'radio','options'=>'goodstype'),
			array('name'=>'goodstitle','title'=>'商品名称','type'=>'string','show'=>array('goodstype'=>0)),
			array('name'=>'goodsid','title'=>'选择商品','type'=>'choose','action'=>'jy_weishop/goods.get_goods//nomerch=1','show'=>array('goodstype'=>1)),
			array('name'=>'goodsid','title'=>'选择防伪商品','type'=>'choose','action'=>'jy_goodsfw/get_goods//nomerch=1','show'=>array('goodstype'=>2)),
			array('type'=>'time','title'=>'信息更新时间','name'=>'UPDATE_TIME','help'=>'留空表示按当前时间发布备案！'),
		),
	);
	$return['htmls']=$htmls;
	$return['goodstype']=array('直接填写','选择商城商品','选择防伪商品');
	if(!$this->plugin_exists('jy_goodsfw')){
		unset($return['goodstype'][2]);
	}
	exi($return);
}
